home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -in_the_mag- / reader_requests / wild / support / wabl / editwablalien / editwablalien.c < prev    next >
C/C++ Source or Header  |  2000-02-23  |  1KB  |  60 lines

  1. /*
  2. **    EditWABL: Simple editing funcs.
  3. */
  4.  
  5. #include <wabl.h>
  6. #include <exec/exec.h>
  7. #include <exec/libraries.h>
  8. #include <dos/dos.h>
  9. #include <utility/tagitem.h>
  10. #include <utility/hooks.h>
  11. #include <inline/dos.h>
  12. #include <inline/intuition.h>
  13.  
  14. extern struct ExecBase *SysBase;
  15. extern struct Library *DOSBase;
  16. extern struct Library *IntuitionBase;
  17.  
  18. #define    ARG_WABLINPUT    0
  19.  
  20. ULONG     *outfh,*wi_view;
  21.  
  22. extern ULONG InitGui();
  23. extern void KillGui();
  24.  
  25. ULONG ReadHook( register struct Hook* hook __asm("a0"), register ULONG object __asm("a2"), register ULONG message __asm("a1"))
  26. {
  27.  return(FGetC(object));
  28. }
  29.  
  30. int main()
  31. {
  32.  ULONG *rda,arg[1];
  33.  if (rda=ReadArgs("WABL/A",&arg,0))
  34.   {
  35.    ULONG *fh;
  36.    if (fh=Open(arg[ARG_WABLINPUT],MODE_OLDFILE))
  37.     {
  38.      struct WABL *wabl;
  39.      struct Hook gethook;
  40.      struct TagItem loadtags[3]={{WABL_FileHandle,fh},{WABL_GetCharHook,&gethook},{0,0}};
  41.      gethook.h_Entry=&ReadHook;
  42.      if (wabl=LoadWABL((struct TagItem*)loadtags))
  43.       {
  44.        outfh=Output();
  45.        if (InitGui())
  46.         {
  47.          InitWABLDisplay(wabl,wi_view);
  48.          RefreshWABLDisplay(wabl,wi_view);
  49.          DrawWABLDisplay(wabl,wi_view);
  50.  
  51.          KillGui();
  52.         } // GUI
  53.        FreeWABL(wabl);
  54.       }
  55.      Close(fh); 
  56.     }
  57.   }
  58. }
  59.  
  60.